<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div th:fragment="onloadJS">
    <script type="text/javascript" th:src="@{/plugins/js/jquery.min.js}"></script>
    <script type="text/javascript" th:src="@{/plugins/js/headroom.min.js}"></script>
    <script type="text/javascript" th:src="@{/plugins/js/instantclick.min.js}"></script>
    <script type="text/javascript">
        var header = new Headroom(document.getElementById("header"), {
            tolerance: 10,
            offset: 80,
            classes: {
                initial: "animated",
                pinned: "slideDown",
                unpinned: "slideUp"
            }
        });
        header.init();

        $('#search-inp').keypress(function (e) {
            var key = e.which; //e.which是按键的值
            if (key === 13) {
                var q = $(this).val();
                if (q && q !== '') {
                    window.location.href = '/search/' + q;
                }
            }
        });
    </script>
    <script type="text/javascript" th:src="@{/plugins/js/highlight.min.js}"></script>
    <script data-no-instant type="text/javascript">
        InstantClick.on('change', function (isInitialLoad) {
            var blocks = document.querySelectorAll('pre code');
            for (var i = 0; i < blocks.length; i++) {
                hljs.highlightBlock(blocks[i]);
            }
            if (isInitialLoad === false) {
                if (typeof ga !== 'undefined') ga('send', 'pageview', location.pathname + location.search);
            }
        });
        InstantClick.init('mousedown');
    </script>
    <script type="text/javascript" th:src="@{/plugins/js/rocket-loader.min.js}"></script>
</div>
</body>
</html>